﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                DialogResult result;
                result=MessageBox.Show("请输入登录账号","输入提示",
                MessageBoxButtons.OKCancel,MessageBoxIcon.Information);
            }
            string zh = textBox1.Text.Trim();
            string mm = textBox2.Text.Trim();
            string sql=string.Format("select * from logon where zh='{0}' and mm='{1}'",zh,mm);
            DataTable lsb = DBhleper.read(sql);
            if (lsb.Rows.Count>0)
            {
                MessageBox.Show("登录成功");
            }
            else
            {
                MessageBox.Show("登录失败");
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim().Length == 0)
            {
                textBox1.Text = "请输入账号";
            }
        }

        private void textBox1_Enter(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() == "请输入账号")
            {
                textBox1.Text = "";
            }
        }

        private void textBox1_Leave(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim().Length == 0)
            {
                textBox1.Text = "请输入账号";
            }
        }
    }
}
